import React, { lazy, Suspense } from 'react';
import { Router, Route, Switch } from 'dva/router';
import { ConfigProvider } from 'antd';
import { Spin } from 'antd'
import zhCN from 'antd/es/locale/zh_CN';
import TotalPage from './routes/TotalPage'
import style from './index.css'
const IndexPage = lazy(() => import('./routes/IndexPage.jsx'))
const InformationPagae = lazy(() => import('./routes/InformationPage.jsx'))
const VerificationPage = lazy(() => import('./routes/VerificationPage.jsx'))
const CertificationPage = lazy(() => import('./routes/CertificationPage.jsx'))
const STVPage = lazy(() => import('./routes/STVPage.jsx'))
const Application = lazy(() => import('./routes/ApplicationPage.jsx'))
const ApplicationPage = lazy(() => import('./routes/ApplicationPage.jsx'))
const SearchPage = lazy(() => import('./routes/SearchPage.jsx'))
const ApplicationProcessPage = lazy(() => import('./routes/ApplicationProcessPage'))
const TechnologyExaminationPage = lazy(() => import('./routes/TechnologyExaminationPage'))
const MechanismOperationPage = lazy(() => import('./routes/MechanismOperationPage'))
const MechanismExaminationPage = lazy(() => import('./routes/MechanismExaminationPage'))
const MechanismPage = lazy(() => import('./routes/MechanismPage'))
const UploadFilePage = lazy(() => import('./routes/UploadFilePage'))
const SeekTechnologyPage = lazy(() => import('./routes/SeekTechnologyPage'))
const UserManagementPagae = lazy(() => import('./routes/UserManagementPage'))
const AdministratorsManagementPage = lazy(() => import('./routes/AdministratorsManagementPage'))
const PolicySimulationPage = lazy(() => import('./routes/PolicySimulationPage'))
const PatentDataAdministerPage = lazy(() => import('./routes/PatentDataAdministerPage'))
const PatentDataSearchPage = lazy(() => import('./routes/patentDataSearchPage'))
const TechnologyValuationPage = lazy(() => import('./routes/TechnologyValuationPage'))
const TechnologyValuationPrinciplePage = lazy(() => import('./routes/TechnologyValuationPrinciplePage'))
const TechnologyValuationDetailsPage = lazy(() => import('./routes/TechnologyValuationDetailsPage'))
const PolicySimulationtoolPage = lazy(() => import('./routes/PolicySimulationtoolPage'))

function RouterConfig({ history }) {
  return (
    <ConfigProvider locale={zhCN}>
      <Router history={history}>
        <Suspense fallback={<div className={style.lazy}><Spin/></div>}>
          <Switch>
            <Route path="/" exact component={TotalPage} />
            <Route path="/technologyValuation" exact component={TechnologyValuationPage} />
            <Route path="/technologyValuation/technicalValuationPrinciple" exact component={TechnologyValuationPrinciplePage} />
            <Route path="/technologyValuation/qualitative" exact component={TechnologyValuationDetailsPage} key="technologyValuationQualitative" />
            <Route path="/technologyValuation/ration" exact component={TechnologyValuationDetailsPage} key="technologyValuationRation" />
            <Route path="/technology" exact component={IndexPage} />
            <Route path="/information" exact component={InformationPagae} />
            <Route path="/verification" exact component={VerificationPage} />
            <Route path="/certification" exact component={CertificationPage} />
            <Route path="/stv" exact component={STVPage} />
            <Route path="/application" exact component={ApplicationPage} />
            <Route path="/application/process" exact component={ApplicationProcessPage} />
            <Route path="/search" exact component={SearchPage} />
            <Route path="/technologyExamination" exact component={TechnologyExaminationPage} />
            <Route path="/mechanismOperation" exact component={MechanismOperationPage} />
            <Route path="/mechanismExamination" exact component={MechanismExaminationPage} />
            <Route path="/mechanism" exact component={MechanismPage} />
            <Route path="/uploadFile" exact component={UploadFilePage} />
            <Route path="/seekTechnology" exact component={SeekTechnologyPage} />
            <Route path="/userManagement" exact component={UserManagementPagae} />
            <Route path="/administratorsManagement" exact component={AdministratorsManagementPage} />
            <Route path="/policySimulation" exact component={PolicySimulationPage} />
            <Route path="/policySimulation/policySimulationtool" exact component={PolicySimulationtoolPage} />
            <Route path="/patentDataAdminister" exact component={PatentDataAdministerPage} />
            <Route path="/patentDataSearch" exact component={PatentDataSearchPage} />
          </Switch>
        </Suspense>
      </Router>
    </ConfigProvider>
  );
}

export default RouterConfig;
